<?php

/**
 * sfGuardPermission filter form.
 *
 * @package    ##PROJECT_NAME##
 * @subpackage filter
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: sfGuardPermissionFormFilter.class.php 12896 2008-11-10 19:02:34Z fabien $
 */
class sfGuardPermissionFormFilter extends BasesfGuardPermissionFormFilter
{
  public function configure()
  {
    unset($this['sf_guard_user_permission_list']);

    $this->widgetSchema['sf_guard_group_permission_list']->setLabel('Groups');
  }
  
    public function setup()
  {
        parent::setup();
    
    $this->setWidgets(array(
      'name'                           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'description'                    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'sf_guard_user_permission_list'  => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUser', 'add_empty' => 'Selecciones un usuario...')),
      'sf_guard_group_permission_list' => new sfWidgetFormPropelChoice(array('model' => 'sfGuardGroup', 'add_empty' => 'Seleccione un grupo...')),
    ));

    $this->setValidators(array(
      'name'                           => new sfValidatorString(array('required' => false)),
      'description'                    => new sfValidatorString(array('required' => false)),
      'sf_guard_user_permission_list'  => new sfValidatorPropelChoice(array('model' => 'sfGuardUser', 'required' => false)),
      'sf_guard_group_permission_list' => new sfValidatorPropelChoice(array('model' => 'sfGuardGroup', 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('sf_guard_permission_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    
  }
}
